GitLab is a web-based DevOps lifecycle tool that provides Git repository management, issue-tracking, and CI/CD pipeline features using an open-source license. In this section of the lab, you will explore the GitLab repository that contains the Services as Code (SaC) configuration files.
Click on the link below to login to GitLab:
You will be redirected to a login screen. Enter the provided username and password:
The SaC-CAIT-Lab repository is already created and initialized with the necessary files for the lab. Additional configuration files will be added to the repository
as we progress through the lab.
validate:
stage: validate
script:
- set -o pipefail && terraform fmt -check |& tee fmt_output.txt
- set -o pipefail && iac-validate ./data/ |& tee validate_output.txt
artifacts:
paths:
- fmt_output.txt
- validate_output.txt
cache: []
rules:
- if: $CI_COMMIT_TAG == null
plan:
stage: plan
resource_group: apic
script:
- terraform init -input=false
- terraform plan -out=plan.tfplan -input=false
- terraform show -no-color plan.tfplan > plan.txt
- terraform show -json plan.tfplan | jq > plan.json
- terraform show -json plan.tfplan | jq '([.resource_changes[]?.change.actions?]|flatten)|{"create":(map(select(.=="create"))|length),"update":(map(select(.=="update"))|length),"delete":(map(select(.=="delete"))|length)}' > plan_gitlab.json
artifacts:
paths:
- plan.json
- plan.txt
- plan.tfplan
- plan_gitlab.json
reports:
terraform: plan_gitlab.json
dependencies: []
needs:
- validate
only:
- merge_requests
- main
deploy:
stage: deploy
resource_group: apic
script:
- terraform init -input=false
- terraform apply -input=false -auto-approve plan.tfplan
dependencies:
- plan
needs:
- plan
only:
- main
test-integration:
stage: test
script:
- set -o pipefail && iac-test -d ./data -d ./defaults.yaml -t ./tests/templates -f ./tests/filters -o ./tests/results/aci |& tee test_output.txt
artifacts:
when: always
paths:
- tests/results/aci/*.html
- tests/results/aci/xunit.xml
- test_output.txt
reports:
junit: tests/results/aci/xunit.xml
dependencies:
- deploy
needs:
- deploy
only:
- main
The integrated test stage test cases are written in Robot Framework and executed against the ACI fabric to verify that the configurations are applied as intended. The integrated test coverage remains at the configuration verification level and does not include operational state or data plane validation. To accomplish this additional necessity to validate the operational state and data plane for the ACI fabric, we will leverage CXTM.
Continue to the next section to configure a tenant on the ACI fabric.